import { fromJS} from "immutable";

import {
    Get_CART_ORDER_DATA,
    SET_LOADING,
} from "./effects";

const initialState = fromJS({
    loading: true,
    data: [],
});

export default (state = initialState, action) => {
    switch (action.type) {
        case Get_CART_ORDER_DATA:
            return state.set("data", fromJS(action.data));
        case SET_LOADING:
            return state.set("loading", action.value);
        default:
            return state;
    }
};
